﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using CsharpTrainer.Model.Entities;
using CsharpTrainer.Core.DAL;

namespace CsharpTrainer.Domain.Services
{
    public class CharacterListService
    {
        public IList<AccountCharacter> GetCharacterListByAccount(string accountName)
        {
            IFunction<AccountCharacter> func = new CharacterListFunc();
            StringBuilder sb = new StringBuilder(@"select  * from fr_game.usp_getcharacter4colbyaccount('");
            sb.Append(accountName).Append("')");
            sb.Append(" as (charactername character varying,characterid bigint,logintime timestamp,loginip character varying);");
            IList<AccountCharacter> characterList = func.Query(sb.ToString());

            return characterList;
        }
    }
}
